package com.pureut.system.api;

import com.pureut.common.core.constant.ServiceNameConstants;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.system.api.dto.SchedulingPlanDto;
import com.pureut.system.api.factory.RemoteSchedulingPlanFallbackFactory;
import com.pureut.system.api.vo.BackAdjustVo;
import com.pureut.system.api.vo.BackWeight;
import com.pureut.system.api.vo.SchedulingPlanVo;
import com.pureut.system.api.vo.UpdateSaleVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;


/**
 * @author yiBao
 */
@FeignClient(contextId = "schedulingPlanFeignService", value = ServiceNameConstants.PUREUT_SCHEDULING, fallbackFactory = RemoteSchedulingPlanFallbackFactory.class)
public interface SchedulingPlanFeignService {

    /**
     * 新增计划
     */
    @PostMapping("/productionPlan/addPlan")
    public AjaxResult addPlan(@RequestBody List<SchedulingPlanVo> schedulingPlanVo) throws Exception;

    /**
     * 根据工厂日历id查询班别信息
     */
    @GetMapping("/shopCalendar/selectShiftSettingList/{calendarId}")
    public AjaxResult selectShiftSettingList(@PathVariable("calendarId") Long calendarId);

    /**
     * 根据线别编码获取班次信息
     */
    @GetMapping("/shopCalendar/selectShiftLine/{lineCode}")
    public AjaxResult selectShiftLine(@PathVariable("lineCode") String lineCode);

    /**
     * 根据排程单号回传实际开始时间and接受时间
     */
    @PutMapping("/productionSchedule/backAdjust")
    public AjaxResult backAdjust(@RequestBody BackAdjustVo backAdjustVo);

    /**
     * 成品称重数据回传排程计划
     * @param backWeight
     * @return
     */
    @PutMapping("/productionPlan/planBack")
    public AjaxResult planBack(@RequestBody BackWeight backWeight);

    /**
     * 分切完成关结且水刺关结完成修改排程单和计划单状态为已完成
     */
    @PutMapping("/productionPlan/updatePlanFinishStatus")
    public AjaxResult updatePlanFinishStatus(@RequestBody BackWeight backWeight);

    /**
     * 根据线别id 和物料编码 查询对应工时
     */
    @GetMapping("/standardHours/hoursOnById")
    public AjaxResult hoursOnById(@RequestParam("lineId") long lineId, @RequestParam("materialCode") String materialCode);

    /**
     * 返回完工时间
     */
    @GetMapping("/productionSchedule/finishTime")
    public Date finishTime(@RequestParam("lineId") long lineId,
                           @RequestParam("expStartTime") long expStartTime,
                           @RequestParam("expWhen") double expWhen);

    /**
     * 通过计划单号获取对应销售订单号(fegin调用)
     * @return
     */
    @GetMapping("/productionPlan/getPlanData")
    public String getPlanData(String planCode);

    /**
     * 通过计划单号查出销售订单号和怕物料编码
     */
    @PostMapping("/productionPlan/getPlanInfo")
    public SchedulingPlanDto getPlanInfo(String planCode);

    /**
     * 修改排程单状态
     */
    @PutMapping("/productionPlan/updatePlanStatus")
    public boolean updatePlanStatusUnit(@RequestBody UpdateSaleVo updateSaleVo);

    /**
     * 修改排程委外重量（扣减）
     * @param backWeight
     * @return
     */
    @PutMapping("/productionPlan/planBackDelete")
    public AjaxResult planBackDelete(@RequestBody BackWeight backWeight);
}
